import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'


export const constantRouterMap = [{
        path: '/login',
        component: () =>
            import ('@/views/login/index'),
        hidden: true
    },
    {
        path: '/404',
        component: () =>
            import ('@/views/404'),
        hidden: true
    },

    {
        path: '/',
        component: Layout,
        redirect: '/merchant',
        name: 'Merchant',
        hidden: true,
        children: [{
                path: 'merchant',
                name: 'Merchant',
                component: () =>
                    import ('@/views/merchant/merchant'),
                meta: {
                    title: '商家',
                    icon: 'icon-chepai'
                }
            }, {
                path: 'category',
                name: 'category',
                component: () =>
                    import ('@/views/property/property'),
                meta: {
                    title: '品类',
                    icon: 'icon-leimupinleifenleileibie'
                }
            },
            {
                path: 'model',
                name: 'model',
                component: () =>
                    import ('@/views/model/model'),
                meta: {
                    title: '车型',
                    icon: 'icon-chepai'
                }
            },
            {
                path: 'index',
                name: 'index',
                component: () =>
                    import ('@/views/statistical/statistical'),
                meta: {
                    title: '数据',
                    icon: 'icon-shuju'
                }
            },
            {
                path: 'loginOut',
                name: 'LoginOut',
                component: () =>
                    import ('@/views/loginOut/loginOut'),
                meta: {
                    title: '退出',
                    icon: 'icon-tuichu'
                }
            },
            {
            	path: 'permission',
            	name: 'permission',
            	component: () =>
            		import ('@/views/permission/permission'),
            	meta: {
            		title: '权限',
            		icon: 'icon-shuju'
            	}
            },
        ]
    },
    {
        path: '*',
        redirect: '/404',
        hidden: true
    }
]

export default new Router({
    scrollBehavior: () => ({
        y: 0
    }),
    routes: constantRouterMap
})
